home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 223_01 / cc1.c < prev    next >
Text File  |  1980-01-01  |  4KB  |  130 lines

  1. /*
  2. ** Small-C Compiler Version 2.7 (fas)
  3. **
  4. ** Copyright 1982, 1983 J. E. Hendrix
  5. **
  6. ** Part 1
  7. */
  8. #include stdio.h
  9. #include cc.def
  10.  
  11. /*
  12. ** miscellaneous storage
  13. */
  14. char
  15. #ifdef OPTIMIZE
  16.   optimize, /* optimize output of staging buffer */
  17. #endif
  18.   level,    /* variable used for multiple pointer levels  fas 2.3 */
  19.   itype,    /* variable used for storing end type       fas 2.3 */
  20.   explevel, /* variable to track multiple pointer levels  fas 2.4 */
  21.   alarm,    /* audible alarm on errors? */
  22.   monitor,  /* monitor function headers? */
  23.   pause,    /* pause for operator on errors? */
  24.   nbflg,    /* no boot flag to return to CCP */
  25.   m80flg,   /* m80 flag for statics (:: or :) */
  26.   iflag,    /* initialize to zeroes ? */
  27.  
  28. #ifdef DYNAMIC
  29.  *stage,    /* output staging buffer */
  30.  *symtab,   /* symbol table */
  31.  *litq,     /* literal pool */
  32.  *macn,     /* macro name buffer */
  33.  *macq,     /* macro string buffer */
  34.  *pline,    /* parsing buffer */
  35.  *mline,    /* macro buffer */
  36. #else
  37.   stage[STAGESIZE],
  38.   symtab[SYMTBSZ],
  39.   litq[LITABSZ],
  40.   macn[MACNSIZE],
  41.   macq[MACQSIZE],
  42.   pline[LINESIZE],
  43.   mline[LINESIZE],
  44.   swq[SWTABSZ],
  45. #endif
  46.  *line,     /* points to pline or mline */
  47.  *lptr,     /* ptr to either */
  48.  *glbptr,   /* ptrs to next entries */
  49.  *locptr,   /* ptr to next local symbol */
  50.  *stagenext,/* next addr in stage */
  51.  *stagelast,/* last addr in stage */
  52.   quote[2], /* literal string for '"' */
  53.  *cptr,     /* work ptrs to any char buffer */
  54.  *cptr2,
  55.  *cptr3,
  56.   msname[NAMESIZE], /* macro symbol name array */
  57.   ssname[NAMESIZE]; /* static symbol name array */
  58. int
  59. #ifdef STGOTO
  60.   nogo,     /* > 0 disables goto statements */
  61.   noloc,    /* > 0 disables block locals */
  62. #endif
  63.   op[16],   /* function addresses of binary operators */
  64.   op2[16],  /* same for unsigned operators */
  65.   opindex,  /* index to matched operator */
  66.   opsize,   /* size of operator in bytes */
  67.   swactive, /* true inside a switch */
  68.   swdefault,/* default label #, else 0 */
  69.  *swnext,   /* address of next entry */
  70.  *swend,    /* address of last table entry */
  71.  *arrptr,   /* ptr to next md array table entry        fas 2.6 */
  72.  *sarrptr,  /* ptr to start of md array table        fas 2.6 */
  73.   arrcount, /* tracks usage of md arrays        fas 2.6 */
  74.  argcs,     /* static copy of argc            fas 2.2 */
  75.  *argvs,    /* static copy of argv            fas 2.6 */
  76.  
  77. #ifdef DYNAMIC
  78.  *wq,       /* while queue */
  79. #else
  80.   wq[WQTABSZ],
  81. #endif
  82.  
  83.  *wqptr,    /* ptr to next entry */
  84.   litptr,   /* ptr to next entry */
  85.   macptr,   /* macro buffer index */
  86.   pptr,     /* ptr to parsing buffer */
  87.   oper,     /* address of binary operator function */
  88.   ch,       /* current character of line being scanned */
  89.   nch,      /* next character of line being scanned */
  90.   declared, /* # of local bytes declared, else -1 when done */
  91.   iflevel,  /* #if... nest level */
  92.   skiplevel,/* level at which #if... skipping started */
  93.   func1,    /* true for first function */
  94.   nxtlab,   /* next avail label # */
  95.   litlab,   /* label # assigned to literal pool */
  96.   beglab,   /* beginning label -- first function */
  97.   csp,      /* compiler relative stk ptr */
  98.   argstk,   /* function arg sp */
  99.   argtop,
  100.   ncmp,     /* # open compound statements */
  101.   errflag,  /* non-zero after 1st error in statement */
  102.   eof,      /* set non-zero on final input eof */
  103.   input,    /* fd # for input file */
  104.   input2[7],/* fd array for "include" file         fas 2.7 */
  105.   inclevel, /* include level for tracking nest depth     fas 2.7 */
  106.   output,   /* fd # for output file */
  107.   files,    /* non-zero if file list specified on cmd line */
  108.   filearg,  /* cur file arg index */
  109.   glbflag,  /* non-zero if internal globals */
  110.   ctext,    /* non-zero to intermix c-source */
  111.   ccode,    /* non-zero while parsing c-code */
  112.             /* zero when passing assembly code */
  113.   listfp,   /* file pointer to list device */
  114.   lastst,   /* last executed statement type */
  115.  *iptr;     /* work ptr to any int buffer */
  116.  
  117. #include cc11.c
  118. #include cc12.c
  119. #include cc13.c
  120.  
  121. #ifndef SEPARATE
  122. #include cc21.c
  123. #include cc22.c
  124. #include cc31.c
  125. #include cc32.c
  126. #include cc33.c
  127. #include cc41.c
  128. #include cc42.c
  129. #endif
  130.